@isTest
private class ChangeRelatedOwnerHandlerTest {
    static testMethod void testMethod1() {
        Account_Owner_Change__c aoc = new Account_Owner_Change__c();
        aoc.Receive_Sale__c = UserInfo.getUserId();
        insert aoc;

        Account acc = TestUtils.createAccount();
        acc.OwnerChangeProc__c = aoc.Id;
        insert acc;

        Event e = new Event();
        e.Account__c = acc.Id;
        e.StartDateTime = Datetime.now();
        e.EndDateTime = Datetime.now().addMinutes(60);
        insert e;

        Task t = new Task();
        t.Account__c = acc.Id;
        //t.StartDateTime = Datetime.now();
        //t.EndDateTime = Datetime.now().addMinutes(60);
        insert t;

        aoc.Status__c = '已批准';
        update aoc;

        delete aoc;
        acc = [select OwnerChangeProc__c from Account where Id = :acc.Id];
        System.assertEquals(null, acc.OwnerChangeProc__c);
    }
}